package com.launcher.minecraft;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {
    
    private Button launchButton;
    private Button settingsButton;
    private Button modsButton;
    private Button resourcePacksButton;
    private Button versionsButton;
    private Button accountsButton;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        initializeComponents();
        setupEventHandlers();
    }
    
    private void initializeComponents() {
        launchButton = findViewById(R.id.launch_button);
        settingsButton = findViewById(R.id.settings_button);
        modsButton = findViewById(R.id.mods_button);
        resourcePacksButton = findViewById(R.id.resource_packs_button);
        versionsButton = findViewById(R.id.versions_button);
        accountsButton = findViewById(R.id.accounts_button);
    }
    
    private void setupEventHandlers() {
        launchButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                launchMinecraft();
            }
        });
        
        settingsButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                openSettings();
            }
        });
        
        modsButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                openModsManager();
            }
        });
        
        resourcePacksButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                openResourcePacks();
            }
        });
        
        versionsButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                openVersionsManager();
            }
        });
        
        accountsButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                openAccountManager();
            }
        });
    }
    
    private void launchMinecraft() {
        Toast.makeText(this, "启动Minecraft...", Toast.LENGTH_SHORT).show();
        // TODO: 实现Minecraft启动逻辑
    }
    
    private void openSettings() {
        Toast.makeText(this, "打开设置...", Toast.LENGTH_SHORT).show();
        // TODO: 打开设置界面
    }
    
    private void openModsManager() {
        Toast.makeText(this, "打开模组管理...", Toast.LENGTH_SHORT).show();
        // TODO: 打开模组管理界面
    }
    
    private void openResourcePacks() {
        Toast.makeText(this, "打开资源包...", Toast.LENGTH_SHORT).show();
        // TODO: 打开资源包界面
    }
    
    private void openVersionsManager() {
        Toast.makeText(this, "打开版本管理...", Toast.LENGTH_SHORT).show();
        // TODO: 打开版本管理界面
    }
    
    private void openAccountManager() {
        Toast.makeText(this, "打开账号管理...", Toast.LENGTH_SHORT).show();
        Intent intent = new Intent(this, AccountManagerActivity.class);
        startActivity(intent);
    }
}
